package com.ace3l.legal.gwt.domainmodule.domainxform;

import com.ace3l.legal.gwt.domainmodule.gwt.GWTStudent;
import com.ace3l.legal.gwt.domainmodule.gwt.GWTUser;
import com.ace3l.legal.backend.domain.Student;
import com.ace3l.legal.backend.domain.User;

/**
 * Created by IntelliJ IDEA.
 * User: ageer
 * Date: Jul 25, 2008
 * Time: 2:27:49 AM
 * To change this template use File | Settings | File Templates.
 */
public class StudentXForm {
    public static GWTStudent toGWT(Student a) {
        if (a == null) return null;
        GWTStudent b = new GWTStudent();
        b.setContactPhone(a.getContactPhone());
        b.setEmail(a.getEmail());
        b.setEmailVerified(a.getEmailVerified());
        b.setFirstName(a.getFirstName());
        b.setId(a.getId());
        b.setLastName(a.getLastName());
        b.setLawSchoolGPA(a.getLawSchoolGPA());
        b.setLawSchoolName(a.getLawSchoolName());
        b.setLawSchoolYear(a.getLawSchoolYear());
        b.setMailAddress1(a.getMailAddress1());
        b.setMailAddress2(a.getMailAddress2());
        b.setMailCity(a.getMailCity());
        b.setMailState(a.getMailState());
        b.setMailZip(a.getMailZip());
        b.setMiddleName(a.getMiddleName());
        b.setStudentStatus(a.getStudentStatus());

        GWTUser u = UserXForm.toGWT(a.getUser());
        b.setUser(u);
        return b;
    }

    public static Student fromGWT(GWTStudent a) {
        if (a == null) return null;
        Student b = new Student();
        b.setContactPhone(a.getContactPhone());
        b.setEmail(a.getEmail());
        b.setEmailVerified(a.getEmailVerified());
        b.setFirstName(a.getFirstName());
        b.setId(a.getId());
        b.setLastName(a.getLastName());
        b.setLawSchoolGPA(a.getLawSchoolGPA());
        b.setLawSchoolName(a.getLawSchoolName());
        b.setLawSchoolYear(a.getLawSchoolYear());
        b.setMailAddress1(a.getMailAddress1());
        b.setMailAddress2(a.getMailAddress2());
        b.setMailCity(a.getMailCity());
        b.setMailState(a.getMailState());
        b.setMailZip(a.getMailZip());
        b.setMiddleName(a.getMiddleName());
        b.setStudentStatus(a.getStudentStatus());

        User u = UserXForm.fromGWT(a.getUser());
        b.setUser(u);
        return b;
    }
}
